from UIAutoTest.三层架构思想.PublicClass import PublicClass


# 元素定位层
class FindElement(PublicClass):
    def __init__(self):
        PublicClass.__init__(self)
        self.driver.get('http://shop-xo.hctestedu.com/admin.php?s=/answer/index.html')

    # 定位新增按钮
    def click(self, btn):
        self.driver.find_element(btn).click()

    # 定位联系人
    def user_name(self):
        return self.driver.find_element_by_xpath('//form[@class="am-form form-validation view-save"]/div[2]/input')

    # 定位电话
    def phone(self):
        return self.driver.find_element_by_xpath('//form[@class="am-form form-validation view-save"]/div[3]/input')

    # 定位标题
    def title(self):
        return self.driver.find_element_by_xpath('//form[@class="am-form form-validation view-save"]/div[4]/input')

    # 定位访问次数
    def access_count(self):
        return self.driver.find_element_by_xpath('//form[@class="am-form form-validation view-save"]/div[5]/input')

    # 定位内容
    def count(self):
        return self.driver.find_element_by_xpath('//form[@class="am-form form-validation view-save"]/div[6]/input')

    # 定位回复内容
    def reply_count(self):
        return self.driver.find_element_by_xpath('//form[@class="am-form form-validation view-save"]/div[7]/input')

    # 定位是否已回复按钮
    def is_reply(self):
        return self.driver.find_element_by_xpath(
            '//form[@class="am-form form-validation view-save"]/div[8]//div[@class="am-switch-container"]')

    # 定位是否显示
    def is_show(self):
        return self.driver.find_element_by_xpath(
            '//form[@class="am-form form-validation view-save"]/div[9]//div[@class="am-switch-container"]')

    # 定位保存按钮
    def sub_btn(self):
        return self.driver.find_element_by_xpath('//form[@class="am-form form-validation view-save"]/div[10]/button')


if __name__ == '__main__':
    FindElement().add_btn()
